<div class="m">
    <a href="gallery/add" style="float: right; margin-top: 14px; margin-right: 100px;">
        <span class="add_buttom"></span>
        Добавить
    </a>
    <div class="pagetitle icon-48-article-add"><h3>Менеджер галерей: Список галерей</h3></div>
    <br clear="all" />
</div>
<?php
if ($this->session->flashdata('message')){
    echo "<div class='status_box'>".$this->session->flashdata('message')."</div>";
}
?>
<div class="gallery_grid">
    <table class="gallery_table" style="width: 100%; background-color: #f3f3f3; color: #666; border-collapse: separate;
border-spacing: 2px;
border-color: gray;">
        <thead style="border-spacing: 1px; color: #666;">
            <tr style="border-spacing: 1px; color: #666;">
                <th width="20" style="text-align: center; background: #f7f7f7; color: #666; border-bottom: 1px solid #CCC;border-left: 1px solid #fff;"> Примеры изображений</th>
                <th width="20" style="text-align: center; background: #f7f7f7; color: #666; border-bottom: 1px solid #CCC;border-left: 1px solid #fff;"> Название галереи</th>
                <th style="text-align: center; background: #f7f7f7; color: #666; border-bottom: 1px solid #CCC;border-left: 1px solid #fff;"> Опубликовано</th>
                <th style="text-align: center; background: #f7f7f7; color: #666; border-bottom: 1px solid #CCC;border-left: 1px solid #fff;"> Действия</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach( $gallery_list as $i => $gallery ): ?>
                 <?php if(count($gallery) > 0): ?>
                <tr class="<?php echo $i%2? 'row0' : 'row1' ?>"   style="border: 1px solid #fff;">
                    <td width="20%" style=" border: 1px solid #fff;" >
                        <div class="thums_block" style=" width: 128px; float: left;margin-left: 28%;">
                            <?php foreach($gallery['photos'] as $key => $photo): ?>
                                <div class="thum" style="float: left; width: 60px; height: 43px;">
                                    <img width="50" src="<?php echo "/photos/".$photo['src_thn'] ?>" style=";border-radius: 5px 5px; border: 1px solid grey;" alt=""/>
                                </div>
                                <?php  if ($key % 2) :?>
                                    <br clear="all"/>
                                <?php endif; ?>
                            <?php endforeach; ?>
                        </div>
                    </td>
                    <td style=" border: 1px solid #fff;" >
                        <div class="category_name" style=" float: left; ">
                            <?php echo $gallery['name'];?>
                        </div>
                    </td>
                    <td style=" border: 1px solid #fff;text-align: center;" >
                        <?php if($gallery['active']):?>
                            <a href="gallery/active/<?php echo $gallery['id'];?>" class="active">&nbsp;</a>
                        <?php else: ?>
                            <a href="gallery/active/<?php echo $gallery['id'];?>" class="deactive">&nbsp;</a>
                        <?php endif; ?>
                    </td>
                    <td style=" border: 1px solid #fff;" >
                        <div class="category_actions" style="text-align: center;">
                                <a href="gallery/edit/<?php echo $gallery['id'];?>"> Редактировать</a> |
                                <a href="gallery/deletecat/<?php echo $gallery['id'];?>"> Удалить</a>
                        </div>
                    </td>
                </tr>
                 <?php endif; ?>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>